<?php
/**
 * Hello View for Hello World Component
 * 
 * @package    Joomla.Tutorials
 * @subpackage Components
 * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_4
 * @license		GNU/GPL
 */
 
// No direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
 
jimport( 'joomla.application.component.view' );
 
/**
 * Hello View
 *
 * @package    Joomla.Tutorials
 * @subpackage Components
 */
class HbViewCrud extends JView
{
	protected $com_name;
	protected $model_name;
	protected $controller_name;
	
	/*
	 * display method of Hello view
	 * @return void
	 **/
	function displayItem($tpl='item')
	{
		$isNew	= ($this->get('Id') < 1);
		if($isNew){
			JToolBarHelper::cancel();
			$text = JText::_( 'New' );
		}
		else{
			JToolBarHelper::cancel( 'cancel', 'Close' );
			$text = JText::_( 'Edit' );
			
			// Get data from the model
			$item =& $this->get('Item');
			
			$this->assignRef('item',	$item);
			$this->assignRef('com_name',	$this->com_name);
			$this->assignRef('controller_name',	$this->controller_name);
		}
		JToolBarHelper::title(   JText::_( $text ).': <small><small>[ ' . $text.' ]</small></small>' );
		JToolBarHelper::save();
		
		parent::display($tpl);
	}
	
	function displayItemList($tpl='item_list')
    {				
        JToolBarHelper::title( JText::_( 'Hello Manager' ), 'generic.png' );
        JToolBarHelper::deleteList();
        JToolBarHelper::editListX();
        JToolBarHelper::addNewX();
		
		// Get data from the model
		pppp
		$item_list =& $this->get('ItemList');
        $this->assignRef( 'item_list', $item_list );
		$this->assignRef('com_name',	$this->com_name);
		$this->assignRef('controller_name',	$this->controller_name);
		
        parent::display($tpl);
    }
}

